<template>
  <div class="dynamic-wrapper">
    <div class="dynamic">
      <div class="col col-left">
        <dynamic-cell v-for="(item, index) in videoListL" :key="index" :item="item"></dynamic-cell>
      </div>
      <div class="col col-right">
        <dynamic-cell v-for="(item, index) in videoListR" :key="index" :item="item"></dynamic-cell>
      </div>
    </div>
  </div>
</template>

<script>
import dynamicCell from "./dynamic-cell";
export default {
  data() {
    return {
      videoListL: [], //左边动态
      videoListR: [], //右边动态
      dynamicList: this.$parent.dynamicList, //动态列
      articleList: [],
      page: 1
    };
  },
  watch: {
    dynamicList() {
      this.videoListL = [];
      this.videoListR = [];
      this.filterDynamic();
    }
  },
  mounted() {
    this.filterDynamic();
  },
  methods: {
    //过滤动态
    filterDynamic() {
      let len = this.dynamicList.length;
      for (let i = 0; i < len; i++) {
        if (i % 2 === 0) {
          this.videoListL.push(this.dynamicList[i]);
        } else {
          this.videoListR.push(this.dynamicList[i]);
        }
      }
    }
  },
  components: {
    dynamicCell
  }
};
</script>

<style lang="less" scoped>
img {
  width: 100%;
}
.dynamic {
  position: relative;
  padding: 0.48rem;
  display: flex;
  justify-content: space-between;

  .col {
    width: 49%;

    // .long {
    //     .video {
    //         //height: 11.06rem;
    //     }
    // }
  }
  .no-dynamic{

  }
}
</style>
